home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C/C++ Users Group Library 1996 July
/
C-C++ Users Group Library July 1996.iso
/
listings
/
v_07_08
/
v7n8048a.txt
< prev
next >
Wrap
Text File
|
1989-09-27
|
811b
|
38 lines
*****Listing 1*****
/* These are determined from the debug information */
#define AND_INSTRUCTION_OFFSET 0x10
#define OR_INSTRUCTION_OFFSET 0x15
set_plot_type(type)
{
unsigned char *pc;
void draw_function();
/* The function you want to modify */
pc = (void *) draw_function;
switch(type)
{
case XOR:
/* Put NOPS for the masking operation */
*(pc + AND_INSTRUCTION OFFSET) = 0x90; /* NOP */
*(pc + AND_INSTRUCITON OFFSET + 1) = 0X90;
*(pc + OR_INSTRUCTION_OFFSET) = 0x03; /* XOR */
break;
case OVERWRITE:
*(pc + AND_INSTRUCTION_OFFSET) = 0x02; /* AND */
*(pc + AND_INSTRUCITON_OFFSET + 1) = 0x00
/* Register */
*(pc + OR_INSTRUCTION_OFFSET) = 0x08; /* OR */
break;
}
return;
{
*********